import { Equal, Expect, ExpectFalse, NotEqual } from "@type-challenges/utils";
type Reverse<T extends unknown[], Res extends unknown[] = []> = T extends [
  infer F,
  ...infer Rest
]
  ? Reverse<Rest, [F, ...Res]>
  : Res;

type FlipArguments<T extends Function> = T extends (
  ...args: infer Args
) => infer Res
  ? (...args: Reverse<Args>) => Res
  : never;

type cases = [
  Expect<Equal<FlipArguments<() => boolean>, () => boolean>>,
  Expect<
    Equal<FlipArguments<(foo: string) => number>, (foo: string) => number>
  >,
  Expect<
    Equal<
      FlipArguments<(arg0: string, arg1: number, arg2: boolean) => void>,
      (arg0: boolean, arg1: number, arg2: string) => void
    >
  >
];
